import config from "@/config"
import http from "@/utils/request"
import qs from "qs"

export default {
	successCode: config.API_SUCCESS_CODE,
	api: {
		tree: {
			url: `${config.API_URL}/sys/func/tree`,
			name: "获取菜单",
			get: async function(){
				return await http.get(this.url);
			}
		},
		add: {
			url: `${config.API_URL}/sys/func/add`,
			name: "添加菜单",
			post: async function(data){
				data = qs.stringify(data)	
				return await http.post(this.url,data);
			}
		},
		del: {
			url: `${config.API_URL}/sys/func/del`,
			name: "添加菜单",
			post: async function(data){
				data = qs.stringify(data, { indices: false })
				return await http.post(this.url,data);
			}
		},
		edit: {
			url: `${config.API_URL}/sys/func/edit`,
			name: "修改菜单",
			post: async function(data){
				data = qs.stringify(data)
				return await http.post(this.url,data);
			}
		},
		move: {
			url: `${config.API_URL}/sys/func/move`,
			name: "移动菜单",
			post: async function(data){
				data = qs.stringify(data)
				return await http.post(this.url,data);
			}
		}
	}
}
